﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace cashautomat
{
    public partial class Form1 : Form
    {
        public Model model;
        public Form1()
        {
            InitializeComponent();
            model = new Model("12345678", "5678", 1000);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }
        private void button4_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (model.login(textBox1.Text, textBox2.Text))
            {
                button2.Enabled = true;
                button3.Enabled = true;
            }
            else
            {
                MessageBox.Show("Rossz jelszó !");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 takecash = new Form2();
            takecash.Show();
            if (takecash.DialogResult == DialogResult.OK)
            {
                model.takeCash(takecash.Getcash);
                button2.Enabled = false;
                button3.Enabled = false;
                textBox1.Clear();
                textBox2.Clear();
            }
            
            if (takecash.DialogResult == DialogResult.OK)
            {
                model.takeCash(takecash.Cash);
            }
            
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Your balance is: " + '\n' + "$", "Balance");
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

    }
}
